/**
 * Created by LoveZ on 2017/7/23.
 * Depending on the jquery-1.11.3.min.js.
 * Depending on the style.css.
 * To cite this document, always state the source as shown above.
 */

;(function (original) {
  jQuery.fn.clone = function () {
    var result = original.apply(this, arguments),
        my_textareas = this.find('textarea').add(this.filter('textarea')),
        result_textareas = result.find('textarea').add(
            result.filter('textarea')),
        my_selects = this.find('select').add(this.filter('select')),
        result_selects = result.find('select').add(result.filter('select'));

    for (var i = 0, l = my_textareas.length; i < l; ++i) {
      $(
          result_textareas[i]).val($(my_textareas[i]).val());
    }
    for (var i = 0, l = my_selects.length; i < l;
        ++i) {
      result_selects[i].selectedIndex = my_selects[i].selectedIndex;
    }
    return result;
  };
})(jQuery.fn.clone);